package com.crm.system.jobhandle;

import com.alibaba.fastjson.JSONObject;
import com.crm.common.util.RedisUtil;
import com.crm.service.contractManager.CustomerContractDbService;
import com.crm.system.service.contactManager.ContactService;
import com.crm.system.service.customerManager.CustomerService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
public class CustomerContractJob {

    private static Logger logger = LoggerFactory.getLogger(CustomerContractJob.class);

    @Autowired
    CustomerService customerService;

    /**
     * 统计上个月各分公司会员新单/续费合同数量定时任务
     */
    @XxlJob("statisticalVipContractCountJob")
    public String statisticalVipContractCountJob() throws Exception {
        XxlJobHelper.log("CRM-JOB");
        char[] contractTypeArr = {'2', '4'}; // 2:会员新单合同; 4:会员续费合同;
        String result = customerService.statisticalVipContractCount(contractTypeArr);
        XxlJobHelper.log(result);
        return result;
    }
}
